#pragma once
#include<boost/asio.hpp>
#include<iostream>
#include<memory>
#include<functional>
#include<string>
#include<array>

class UdpServ
	:public std::enable_shared_from_this<UdpServ>
{
private:
	boost::asio::ip::udp::socket m_socket;
	std::array<char, 1024> buff;
	boost::asio::ip::udp::endpoint m_remoteEndpoint;

private:
	UdpServ(boost::asio::io_context& ioc);
	void handleRecv(const boost::system::error_code& ec, size_t bytes);

public:
	static std::shared_ptr<UdpServ> create(boost::asio::io_context& ioc);
	void startRecv();

};